package thread.thread_pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test2 {
    public static void main(String[] args) {
        // 核心线程为5，最大线程为5
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        for (int i = 0; i < 5; i++) {
            int finalI = i;
            executorService.submit(()-> System.out.println(Thread.currentThread().getName() + "-" + finalI));
        }
        executorService.shutdown();
    }
}
